/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.softmarket.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Marcelo
 */
@Entity
@Table(name = "telefone")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Telefone.findAll", query = "SELECT t FROM Telefone t"),
    @NamedQuery(name = "Telefone.findByIdtelefone", query = "SELECT t FROM Telefone t WHERE t.idtelefone = :idtelefone"),
    @NamedQuery(name = "Telefone.findByComercial", query = "SELECT t FROM Telefone t WHERE t.comercial = :comercial"),
    @NamedQuery(name = "Telefone.findByFax", query = "SELECT t FROM Telefone t WHERE t.fax = :fax"),
    @NamedQuery(name = "Telefone.findByResidencial", query = "SELECT t FROM Telefone t WHERE t.residencial = :residencial"),
    @NamedQuery(name = "Telefone.findByCelular", query = "SELECT t FROM Telefone t WHERE t.celular = :celular")})
public class Telefone implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idtelefone")
    private Integer idtelefone;
    @Basic(optional = false)
    @Column(name = "comercial")
    private int comercial;
    @Column(name = "fax")
    private String fax;
    @Column(name = "residencial")
    private String residencial;
    @Basic(optional = false)
    @Column(name = "celular")
    private String celular;
    @ManyToMany(mappedBy = "telefoneList")
    private List<Pessoa> pessoaList;

    public Telefone() {
    }

    public Telefone(Integer idtelefone) {
        this.idtelefone = idtelefone;
    }

    public Telefone(Integer idtelefone, int comercial, String celular) {
        this.idtelefone = idtelefone;
        this.comercial = comercial;
        this.celular = celular;
    }

    public Integer getIdtelefone() {
        return idtelefone;
    }

    public void setIdtelefone(Integer idtelefone) {
        this.idtelefone = idtelefone;
    }

    public int getComercial() {
        return comercial;
    }

    public void setComercial(int comercial) {
        this.comercial = comercial;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getResidencial() {
        return residencial;
    }

    public void setResidencial(String residencial) {
        this.residencial = residencial;
    }

    public String getCelular() {
        return celular;
    }

    public void setCelular(String celular) {
        this.celular = celular;
    }

    @XmlTransient
    public List<Pessoa> getPessoaList() {
        return pessoaList;
    }

    public void setPessoaList(List<Pessoa> pessoaList) {
        this.pessoaList = pessoaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtelefone != null ? idtelefone.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Telefone)) {
            return false;
        }
        Telefone other = (Telefone) object;
        if ((this.idtelefone == null && other.idtelefone != null) || (this.idtelefone != null && !this.idtelefone.equals(other.idtelefone))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.softmarket.modelo.Telefone[ idtelefone=" + idtelefone + " ]";
    }
    
}
